package jdbc;

import java.io.File;
import java.util.List;

import com.swf.common.utils.FwsFileUtils;
import com.swf.common.utils.FwsPatternUtils;

public class order {
	private static String insert_sql = "insert into orderInterface(vc_servicename,c_functionno,l_fieldid,l_len,l_declen,l_orderno,vc_fieldname,c_datatype,vc_desc,c_flag) values (allfields);";

	public static void main(String[] args) {
		File file = FwsFileUtils.getFile("jdbc/order.txt");
		String content;
		try {
			content = FwsFileUtils.loadFile(file, "GBK");
			List<String> list = FwsPatternUtils.matchedList(content, ".+");
			for (String s:list){
				System.out.println(insert_sql.replace("allfields",getAllFields(s)));
			}
		} catch (Exception e) {

		}
	}
	
	private static String getAllFields(String s){
		String[] fields =  s.split("\\s+");
		StringBuffer sb = new StringBuffer();
		for (String filed:fields){
			sb.append("'"+filed+"',");
		}
		return sb.toString()+"'1'";
	}
}
